package win.ganbo.easyframwork.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import win.ganbo.easyframwork.domain.User;
import win.ganbo.easyframwork.service.IUserService;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController extends BaseController {

    @Autowired
    IUserService userService;


    @GetMapping("/listUI")
    public  String  listUI(){
        System.out.println("用户列表===================");
        return "/user/list";
    }

    @RequestMapping("/list")
    @ResponseBody
    public Object list(){
        System.out.println("list=====>");
        List<User> list = userService.findAll();
        return list;
    }


    @Override
    public void setPageInfo(String title, HttpServletRequest request) {
        request.setAttribute(PAGE_INFO,"用户管理");
    }
}
